home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Programming / powerd / modules.lha / modules / devices / ahi.m < prev    next >
Encoding:
Text File  |  2000-06-11  |  13.2 KB  |  313 lines

  1. /*
  2. **    $VER: ahi.h 4.2 (27.4.97)
  3. **
  4. **    ahi.device definitions
  5. **
  6. **    (C) Copyright 1994-1997 Martin Blom
  7. **    All Rights Reserved.
  8. **
  9. ** (TAB SIZE: 8)
  10. */
  11. /*****************************************************************************/
  12. MODULE    'exec/io',
  13.             'utility/tagitem',
  14.             'libraries/iffparse'
  15. /*****************************************************************************/
  16. #ifndef EIGHTSVX_H
  17. /* Do not define Fixed twice */
  18. /* A fixed-point value, 16 bits
  19.                            to the left of the point and
  20.                            16 bits to the right */
  21. #define Fixed LONG
  22. #endif
  23. /*** STRUCTURES */
  24. /* AHIAudioCtrl */
  25. OBJECT AHIAudioCtrl
  26.     UserData:PTR     /* Lots of private data follows! */
  27.  
  28. /* AHISoundMessage */
  29. OBJECT AHISoundMessage
  30.     Channel:UWORD
  31.  
  32. /* AHIRecordMessage */
  33. OBJECT AHIRecordMessage
  34.     Type:ULONG,      /* Format of buffer (object) */
  35.     Buffer:PTR,      /* Pointer to the sample array */
  36.     Length:ULONG     /* Number of sample frames in buffer */
  37.  
  38. /* AHISampleInfo */
  39. OBJECT AHISampleInfo
  40.     Type:ULONG,      /* Format of samples */
  41.     Address:PTR,     /* Address to array of samples */
  42.     Length:ULONG     /* Number of samples in array */
  43.  
  44. /* AHIAudioModeRequester */
  45. OBJECT AHIAudioModeRequester
  46.     AudioID:ULONG,        /* Selected audio mode */
  47.     MixFreq:ULONG,        /* Selected mixing/sampling frequency */
  48.     LeftEdge:WORD,        /* Coordinates of requester on exit */
  49.     TopEdge:WORD,
  50.     Width:WORD,
  51.     Height:WORD,
  52.     InfoOpened:BOOL,      /* Info window opened on exit? */
  53.     InfoLeftEdge:WORD,    /* Last coordinates of Info window */
  54.     InfoTopEdge:WORD,
  55.     InfoWidth:WORD,
  56.     InfoHeight:WORD,
  57.     UserData:PTR          /* You can store your own data here */
  58.  
  59. /* AHIEffMasterVolume */
  60. OBJECT AHIEffMasterVolume
  61.     Effect:ULONG,      /* Set to AHIET_MASTERVOLUME */
  62.     Volume:Fixed     /* See autodocs for range! */
  63.  
  64. /* AHIEffOutputBuffer */
  65. OBJECT AHIEffOutputBuffer
  66.     Effect:ULONG,          /* Set to AHIET_OUTPUTBUFFER */
  67.     Func:PTR TO Hook,    /* These fields are filled by AHI */
  68.     Type:ULONG,          /* Format of buffer */
  69.     Buffer:PTR,          /* Pointer to the sample array */
  70.     Length:ULONG         /* Number of sample frames in buffer */
  71.  
  72. /* AHIEffDSPMask (V4) */
  73. OBJECT AHIEffDSPMask
  74.     Effect:ULONG,        /* Set to AHIET_DSPMASK */
  75.     Channels:UWORD,    /* Number of elements in array */
  76.     Mask[0]:UBYTE      /* Here follows the array */
  77.  
  78. #define AHIEDM_WET         (0)
  79. #define AHIEDM_DRY         (1)
  80. /* AHIEffDSPEcho (V4) */
  81. OBJECT AHIDSPEcho
  82.     Effect:ULONG,        /* Set to AHIET_DSPECHO */
  83.     Delay:ULONG,       /* In samples */
  84.     Feedback:Fixed,
  85.     Mix:Fixed,
  86.     Cross:Fixed
  87.  
  88. /* AHIEffChannelInfo (V4) */
  89. OBJECT AHIEffChannelInfo
  90.     Effect:ULONG,          /* Set to AHIET_CHANNELINFO */
  91.     Func:PTR TO Hook,
  92.     Channels:UWORD,
  93.     Pad:UWORD,           /* The rest is filled by AHI */
  94.     Offset[0]:ULONG      /* The array follows */
  95.  
  96. /*** TAGS */
  97. #define AHI_TagBase         (TAG_USER)
  98. #define AHI_TagBaseR         (AHI_TagBase|$8000)
  99. /* AHI_AllocAudioA tags */
  100. #define AHIA_AudioID         (AHI_TagBase+1)        /* Desired audio mode */
  101. #define AHIA_MixFreq         (AHI_TagBase+2)        /* Suggested mixing frequency */
  102. #define AHIA_Channels         (AHI_TagBase+3)        /* Suggested number of channels */
  103. #define AHIA_Sounds         (AHI_TagBase+4)        /* Number of sounds to use */
  104. #define AHIA_SoundFunc         (AHI_TagBase+5)        /* End-of-Sound Hook */
  105. #define AHIA_PlayerFunc         (AHI_TagBase+6)        /* Player Hook */
  106. #define AHIA_PlayerFreq         (AHI_TagBase+7)        /* Frequency for player Hook (Fixed)*/
  107. #define AHIA_MinPlayerFreq     (AHI_TagBase+8)        /* Minimum Frequency for player Hook */
  108. #define AHIA_MaxPlayerFreq     (AHI_TagBase+9)        /* Maximum Frequency for player Hook */
  109. #define AHIA_RecordFunc         (AHI_TagBase+10)    /* Sample recording Hook */
  110. #define AHIA_UserData         (AHI_TagBase+11)    /* What to put in ahiac_UserData */
  111. /* AHI_PlayA tags (V4) */
  112. #define AHIP_BeginChannel     (AHI_TagBase+40)    /* All command tags should be... */
  113. #define AHIP_EndChannel         (AHI_TagBase+41)    /* ... enclosed by these tags. */
  114. #define AHIP_Freq         (AHI_TagBase+50)
  115. #define AHIP_Vol         (AHI_TagBase+51)
  116. #define AHIP_Pan         (AHI_TagBase+52)
  117. #define AHIP_Sound         (AHI_TagBase+53)
  118. #define AHIP_Offset         (AHI_TagBase+54)
  119. #define AHIP_Length         (AHI_TagBase+55)
  120. #define AHIP_LoopFreq         (AHI_TagBase+60)
  121. #define AHIP_LoopVol         (AHI_TagBase+61)
  122. #define AHIP_LoopPan         (AHI_TagBase+62)
  123. #define AHIP_LoopSound         (AHI_TagBase+63)
  124. #define AHIP_LoopOffset         (AHI_TagBase+64)
  125. #define AHIP_LoopLength         (AHI_TagBase+65)
  126. /* AHI_ControlAudioA tags */
  127. #define AHIC_Play         (AHI_TagBase+80)    /* Boolean */
  128. #define AHIC_Record         (AHI_TagBase+81)    /* Boolean */
  129. #define AHIC_MonitorVolume     (AHI_TagBase+82)
  130. #define AHIC_MonitorVolume_Query  (AHI_TagBase+83)    /* ti_Data is pointer to Fixed (LONG) */
  131. #define AHIC_MixFreq_Query     (AHI_TagBase+84)    /* ti_Data is pointer to ULONG */
  132. /* --- New for V2, they will be ignored by V1 --- */
  133. #define AHIC_InputGain         (AHI_TagBase+85)
  134. #define AHIC_InputGain_Query     (AHI_TagBase+86)    /* ti_Data is pointer to Fixed (LONG) */
  135. #define AHIC_OutputVolume     (AHI_TagBase+87)
  136. #define AHIC_OutputVolume_Query     (AHI_TagBase+88)    /* ti_Data is pointer to Fixed (LONG) */
  137. #define AHIC_Input         (AHI_TagBase+89)
  138. #define AHIC_Input_Query     (AHI_TagBase+90)    /* ti_Data is pointer to ULONG */
  139. #define AHIC_Output         (AHI_TagBase+91)
  140. #define AHIC_Output_Query     (AHI_TagBase+92)    /* ti_Data is pointer to ULONG */
  141. /* AHI_GetAudioAttrsA tags */
  142. #define AHIDB_AudioID         (AHI_TagBase+100)
  143. #define AHIDB_Driver         (AHI_TagBaseR+101)    /* Pointer to name of driver */
  144. #define AHIDB_Flags         (AHI_TagBase+102)    /* Private! */
  145. #define AHIDB_Volume         (AHI_TagBase+103)    /* Boolean */
  146. #define AHIDB_Panning         (AHI_TagBase+104)    /* Boolean */
  147. #define AHIDB_Stereo         (AHI_TagBase+105)    /* Boolean */
  148. #define AHIDB_HiFi         (AHI_TagBase+106)    /* Boolean */
  149. #define AHIDB_PingPong         (AHI_TagBase+107)    /* Boolean */
  150. #define AHIDB_MultTable         (AHI_TagBase+108)    /* Private! */
  151. #define AHIDB_Name         (AHI_TagBaseR+109)    /* Pointer to name of this mode */
  152. #define AHIDB_Bits         (AHI_TagBase+110)    /* Output bits */
  153. #define AHIDB_MaxChannels     (AHI_TagBase+111)    /* Max supported channels */
  154. #define AHIDB_MinMixFreq     (AHI_TagBase+112)    /* Min mixing freq. supported */
  155. #define AHIDB_MaxMixFreq     (AHI_TagBase+113)    /* Max mixing freq. supported */
  156. #define AHIDB_Record         (AHI_TagBase+114)    /* Boolean */
  157. #define AHIDB_Frequencies     (AHI_TagBase+115)
  158. #define AHIDB_FrequencyArg     (AHI_TagBase+116)    /* ti_Data is frequency index */
  159. #define AHIDB_Frequency         (AHI_TagBase+117)
  160. #define AHIDB_Author         (AHI_TagBase+118)    /* Pointer to driver author name */
  161. #define AHIDB_Copyright         (AHI_TagBase+119)    /* Pointer to driver copyright notice */
  162. #define AHIDB_Version         (AHI_TagBase+120)    /* Pointer to driver version string */
  163. #define AHIDB_Annotation     (AHI_TagBase+121)    /* Pointer to driver annotation text */
  164. #define AHIDB_BufferLen         (AHI_TagBase+122)    /* Specifies the string buffer size */
  165. #define AHIDB_IndexArg         (AHI_TagBase+123)    /* ti_Data is frequency! */
  166. #define AHIDB_Index         (AHI_TagBase+124)
  167. #define AHIDB_Realtime         (AHI_TagBase+125)    /* Boolean */
  168. #define AHIDB_MaxPlaySamples     (AHI_TagBase+126)    /* It's sample *frames* */
  169. #define AHIDB_MaxRecordSamples     (AHI_TagBase+127)    /* It's sample *frames* */
  170. #define AHIDB_FullDuplex     (AHI_TagBase+129)    /* Boolean */
  171. /* --- New for V2, they will be ignored by V1 --- */
  172. #define AHIDB_MinMonitorVolume     (AHI_TagBase+130)
  173. #define AHIDB_MaxMonitorVolume     (AHI_TagBase+131)
  174. #define AHIDB_MinInputGain     (AHI_TagBase+132)
  175. #define AHIDB_MaxInputGain     (AHI_TagBase+133)
  176. #define AHIDB_MinOutputVolume     (AHI_TagBase+134)
  177. #define AHIDB_MaxOutputVolume     (AHI_TagBase+135)
  178. #define AHIDB_Inputs         (AHI_TagBase+136)
  179. #define AHIDB_InputArg         (AHI_TagBase+137)    /* ti_Data is input index */
  180. #define AHIDB_Input         (AHI_TagBase+138)
  181. #define AHIDB_Outputs         (AHI_TagBase+139)
  182. #define AHIDB_OutputArg         (AHI_TagBase+140)    /* ti_Data is input index */
  183. #define AHIDB_Output         (AHI_TagBase+141)
  184. /* --- New for V4, they will be ignored by V2 and earlier --- */
  185. #define AHIDB_Data         (AHI_TagBaseR+142)    /* Private! */
  186. /* AHI_BestAudioIDA tags */
  187. /* --- New for V4, they will be ignored by V2 and earlier --- */
  188. #define AHIB_Dizzy         (AHI_TagBase+190)
  189. /* AHI_AudioRequestA tags */
  190. /* Window control */
  191. #define AHIR_Window         (AHI_TagBase+200)    /* Parent window */
  192. #define AHIR_Screen         (AHI_TagBase+201)    /* Screen to open on if no window */
  193. #define AHIR_PubScreenName     (AHI_TagBase+202)    /* Name of public screen */
  194. #define AHIR_PrivateIDCMP     (AHI_TagBase+203)    /* Allocate private IDCMP? */
  195. #define AHIR_IntuiMsgFunc     (AHI_TagBase+204)    /* Function to handle IntuiMessages */
  196. #define AHIR_SleepWindow     (AHI_TagBase+205)    /* Block input in AHIR_Window? */
  197. #define AHIR_UserData         (AHI_TagBase+206)    /* What to put in ahiam_UserData */
  198. /* Text display */
  199. #define AHIR_TextAttr         (AHI_TagBase+220)    /* Text font to use for gadget text */
  200. #define AHIR_Locale         (AHI_TagBase+221)    /* Locale to use for text */
  201. #define AHIR_TitleText         (AHI_TagBase+222)    /* Title of requester */
  202. #define AHIR_PositiveText     (AHI_TagBase+223)    /* Positive gadget text */
  203. #define AHIR_NegativeText     (AHI_TagBase+224)    /* Negative gadget text */
  204. /* Initial settings */
  205. #define AHIR_InitialLeftEdge     (AHI_TagBase+240)    /* Initial requester coordinates */
  206. #define AHIR_InitialTopEdge     (AHI_TagBase+241)
  207. #define AHIR_InitialWidth     (AHI_TagBase+242)    /* Initial requester dimensions */
  208. #define AHIR_InitialHeight     (AHI_TagBase+243)
  209. #define AHIR_InitialAudioID     (AHI_TagBase+244)    /* Initial audio mode id */
  210. #define AHIR_InitialMixFreq     (AHI_TagBase+245)    /* Initial mixing/sampling frequency */
  211. #define AHIR_InitialInfoOpened     (AHI_TagBase+246)    /* Info window initially opened? */
  212. #define AHIR_InitialInfoLeftEdge  (AHI_TagBase+247)    /* Initial Info window coords. */
  213. #define AHIR_InitialInfoTopEdge  (AHI_TagBase+248)
  214. #define AHIR_InitialInfoWidth     (AHI_TagBase+249)    /* Not used! */
  215. #define AHIR_InitialInfoHeight     (AHI_TagBase+250)    /* Not used! */
  216. /* Options */
  217. #define AHIR_DoMixFreq         (AHI_TagBase+260)    /* Allow selection of mixing frequency? */
  218. #define AHIR_DoDefaultMode     (AHI_TagBase+261)    /* Allow selection of default mode? (V4) */
  219. /* Filtering */
  220. #define AHIR_FilterTags         (AHI_TagBase+270)    /* Pointer to filter taglist */
  221. #define AHIR_FilterFunc         (AHI_TagBase+271)    /* Function to filter mode id's */
  222. /*** DEFS */
  223. #define AHINAME             'ahi.device'
  224. #define AHI_INVALID_ID         (~0)            /* Invalid Audio ID */
  225. #define AHI_DEFAULT_ID         ($00000000)            /* Only for AHI_AllocAudioA()! */
  226. #define AHI_LOOPBACK_ID         ($00000001)            /* Special sample render Audio ID */
  227. #define AHI_DEFAULT_FREQ     (0)            /* Only for AHI_AllocAudioA()! */
  228. #define AHI_MIXFREQ         (~0)            /* Special frequency for AHI_SetFreq() */
  229. #define AHI_NOSOUND         ($ffff)            /* Turns a channel off */
  230. /* Set#? Flags */
  231. #define AHISF_IMM         (1<<0)
  232. #define AHISB_IMM         (0)
  233. /* Effect Types */
  234. #define AHIET_CANCEL         (1<<31)            /* OR with effect to disable */
  235. #define AHIET_MASTERVOLUME     (1)
  236. #define AHIET_OUTPUTBUFFER     (2)
  237. /* --- New for V4 --- */
  238. #define AHIET_DSPMASK         (3)
  239. #define AHIET_DSPECHO         (4)
  240. #define AHIET_CHANNELINFO     (5)
  241. /* Sound Types */
  242. #define AHIST_NOTYPE         (~0)            /* Private */
  243. #define AHIST_SAMPLE         (0)            /* 8 or 16 bit sample */
  244. #define AHIST_DYNAMICSAMPLE     (1)            /* Dynamic sample */
  245. #define AHIST_INPUT         (1<<29)            /* The input from your sampler */
  246. #define AHIST_BW         (1<<30)            /* Private */
  247. /* Sample types */
  248. /* Note that only AHIST_M8S, AHIST_S8S, AHIST_M16S and AHIST_S16S
  249.    are supported by AHI_LoadSound(). */
  250. #define AHIST_M8S         (0)            /* Mono, 8 bit signed (BYTE) */
  251. #define AHIST_M16S         (1)            /* Mono, 16 bit signed (WORD) */
  252. #define AHIST_S8S         (2)            /* Stereo, 8 bit signed (2×BYTE) */
  253. #define AHIST_S16S         (3)            /* Stereo, 16 bit signed (2×WORD) */
  254. #define AHIST_M32S         (8)            /* Mono, 32 bit signed (LONG) */
  255. #define AHIST_S32S         (10)            /* Stereo, 32 bit signed (2×LONG) */
  256. #define AHIST_M8U         (4)            /* OBSOLETE! */
  257. /* Error codes */
  258. #define AHIE_OK             (0)            /* No error */
  259. #define AHIE_NOMEM         (1)            /* Out of memory */
  260. #define AHIE_BADSOUNDTYPE     (2)            /* Unknown sound type */
  261. #define AHIE_BADSAMPLETYPE     (3)            /* Unknown/unsupported sample type */
  262. #define AHIE_ABORTED         (4)            /* User-triggered abortion */
  263. #define AHIE_UNKNOWN         (5)            /* Error, but unknown */
  264. #define AHIE_HALFDUPLEX         (6)            /* CMD_WRITE/CMD_READ failure */
  265. /* DEVICE INTERFACE DEFINITIONS FOLLOWS ************************************/
  266. /* Device units */
  267. #define AHI_DEFAULT_UNIT     (0)
  268. #define AHI_NO_UNIT         (255)
  269. /* The preference file */
  270. #define ID_AHIU  "AHIU"
  271. #define ID_AHIG  "AHIG"
  272. OBJECT AHIUnitPrefs
  273.     Unit:UBYTE,
  274.     Pad:UBYTE,
  275.     Channels:UWORD,
  276.     AudioMode:ULONG,
  277.     Frequency:ULONG,
  278.     MonitorVolume:Fixed,
  279.     InputGain:Fixed,
  280.     OutputVolume:Fixed,
  281.     Input:ULONG,
  282.     Output:ULONG
  283.  
  284. OBJECT AHIGlobalPrefs
  285.     DebugLevel:UWORD,         /* Range: 0-3 (for None, Low,
  286.                                           High and All) */
  287.     DisableSurround:BOOL,
  288.     DisableEcho:BOOL,
  289.     FastEcho:BOOL,
  290.     MaxCPU:Fixed,
  291.     ClipMasterVolume:BOOL
  292.  
  293. /* Debug levels */
  294. #define AHI_DEBUG_NONE         (0)
  295. #define AHI_DEBUG_LOW         (1)
  296. #define AHI_DEBUG_HIGH         (2)
  297. #define AHI_DEBUG_ALL         (3)
  298. /* AHIRequest */
  299. OBJECT AHIRequest
  300.     Std:IOStdReq,              /* Standard IO request */
  301.     Version:UWORD,             /* Needed version */
  302.     Pad1:UWORD,
  303.     Private[2]:ULONG,          /* Hands off! */
  304.     Type:ULONG,                /* Sample format */
  305.     Frequency:ULONG,           /* Sample/Record frequency */
  306.     Volume:Fixed,              /* Sample volume */
  307.     Position:Fixed,            /* Stereo position */
  308.     Link:PTR TO AHIRequest     /* For double buffering */
  309.  
  310. /* Flags for OpenDevice() */
  311. #define AHIDF_NOMODESCAN     (1<<0)
  312. #define AHIDB_NOMODESCAN     (0)
  313.